package net.lzzy.practices.entities;


import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Entity
@Getter
@Setter
public class Course extends BaseEntity{
    private String name;

    private String description;
    //课程封面
    private String cover;
    //课程创建时间
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
    //课程更新时间
    @Temporal(TemporalType.TIMESTAMP)
    private Date updateTime;

    private boolean open;
    //课程包含老师
    @ManyToOne
    private User teacher;
    //课程包含学生
    @ManyToMany
    private List<User> students = new ArrayList<>();
    //课程包含章节
    @OneToMany(mappedBy = "course")
    private List<Chapter> chapters = new ArrayList<>();

    @OneToMany(mappedBy = "course")
    private List<Applicant> applicants = new ArrayList<>();


    public Course(){
        createTime = new Date();
        updateTime = new Date();
    }

}
